package com.freedom.admin.application.service.cmd;

import com.freedom.admin.application.converter.PermissionConverter;
import com.freedom.admin.domain.service.PermissionService;
import com.freedom.admin.infrastructure.persistence.pojo.bo.PermissionBO;
import com.freedom.admin.infrastructure.persistence.pojo.form.PermissionForm;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class PermissionCmdService {

    private final PermissionService permissionService;

    private final PermissionConverter permissionConverter;

    public Boolean modifyPermission(PermissionForm permissionForm) {
        PermissionBO permissionBO = permissionConverter.toBO(permissionForm);
        permissionService.modifyPermission(permissionBO);
        return Boolean.TRUE;
    }

    public Boolean addPermission(PermissionForm permissionForm) {
        PermissionBO permissionBO = permissionConverter.toBO(permissionForm);
        permissionService.addPermission(permissionBO);
        return Boolean.TRUE;
    }

    public Boolean removeByIds(List<Integer> ids) {
        permissionService.removeByIds(ids);
        return Boolean.TRUE;
    }
}
